/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ManagedBeans;

import java.io.Serializable;
import javax.enterprise.context.SessionScoped;
import javax.faces.event.AjaxBehaviorEvent;
import javax.inject.Named;
import ejb.RequestXML;
import ejb.XSLT;
import javax.ejb.EJB;

/**
 *
 * @author Betty 
*/
@Named("test")
@SessionScoped
public class TestBean implements Serializable{
    private static String[] selections = {"NumberOne","NumberTwo","NumberThree"};
    private double money;
    private boolean activeJob;
    private String xml;
    @EJB
    private RequestXML rXML;
    @EJB 
    private XSLT rXsl;
    /**
     * Creates a new instance of uiTestBean
     */
    public TestBean() {
        money = 123456.689;  
        activeJob = true;
    }
        
    public String[] getSelections(){
        return selections;
    }
    
    public void setSelections(String[] sels ){
        selections = sels;
    }
    
    public double getMoney()
    {
        return money;
    }
    
    public void setMoney(double myMoney)
    {
        this.money = myMoney;
    }
    
    public void aJobNoChanged(AjaxBehaviorEvent event)
    {
        if (activeJob) 
        {
            activeJob = false;
            selections[0] = "false";
            selections[1] = "balls";
            setMoney(911.12);
            xml = "";
        }else{
            activeJob = true;
            selections[0] = "true";
            setMoney(119.21);
            String[] mValues = new String[2];
            mValues = rXML.getXmlData();
            xml = rXsl.transform(mValues[0], mValues[1]);
        }
                
    }  
        public boolean getActiveJob()
                {
                    return activeJob;
                }
        
        public String getXml()
        {                       
            return xml;
        }
        
                
}
